import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-09-22
 * Time: 19:51
 */
public class Main {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            if(n == 1){
                System.out.println(1);
                return;
            }
            int[] arr = new int[n];
            for(int i = 0; i < n; i++){
                arr[i] = in.nextInt();
            }
            int x = 0;
            while(x < n - 1 && arr[x] == arr[x + 1]){
                x++;
            }
            if(x == n - 1){
                System.out.println(1);
                return;
            }
            boolean flag = true;//递增
            if(arr[x] > arr[x + 1]){
                flag = false;//递减
            }
            int sum = 0;
            for(int i = x; i < n - 1; i++){
                if(flag){
                    if(arr[i] > arr[i + 1]){
                        sum++;
                        flag = false;
                    }
                }else{
                    if(arr[i] < arr[i + 1]){
                        sum++;
                        flag = true;
                    }
                }
            }

            System.out.println(sum + 1);
        }
}